<?php
/**
 * Created by PhpStorm.
 * User: SAMSUNG-R428
 * Date: 16-1-26
 */

namespace Application\Dao;

use Infobird\Dao\MysqliBaseDao;

class PriceDao extends MysqliBaseDao
{
	/**
	 * 提供数据表名
	 * @return string
	 */
	protected  function _provideTableName() {
		return 't_price';
	}

	public function contPrice(){
        $sql = "SELECT COUNT(0) FROM t_price";
        return $this->queryBySql($sql);
    }

    public function pageAll($page,$pageSize){
        $sql = "SELECT * FROM t_price ";
        $where = " ORDER BY t_price.id DESC LIMIT ".($page - 1)*$pageSize .",".$pageSize;
        $sqls = $sql.$where;
        return $this->queryBySql($sqls);
    }

    public function serachPrice($oldadress,$destination){
        $sql = "SELECT
                  *
                FROM
                    t_price
                WHERE
                    t_price.oldadress LIKE '%{$oldadress}%'
                AND t_price.destination LIKE '%{$destination}%'";
        return $this->queryBySql($sql);
    }
}